#!/bin/sh
#
#Script to run dlvhex reasoning in an infinitive loop
#
# 1332313696
cd /home/thang/Study/Projects/diaryreasoner/

i=0

echo "\n------ PRIMARY REASONING -------"

while true
do
	i=$(($i+1))
	echo $i
	date --rfc-3339=ns

	echo "\n------ buffering -------"
	# look at class autodiaryserver.DSMS for the fomate of the inputs
	java -jar /home/thang/Study/Projects/AutoDiaryServer/dist/AutoDiaryServer.jar buffer 1337828441 1338368158
	#java -jar /home/thang/Study/Projects/AutoDiaryServer/dist/AutoDiaryServer.jar buffer 1330990644 1330990944
	echo "\n------ reasoning simple act (should call complex act here as well)-------"
	# because simple act will be refreshed (new) after 5 times (=window size) only
	dlv -silent sensoring simpleAct constraints location > result.txt
	#dlv -silent -brave sensoring simpleAct complexAct activity.query
	#dlv dailyActs -n=1 -silent
	echo "\n------ simple act ambiguous reasoning - when window is fully loaded"
	#(with full infor like actName, speed, violation...) -------
	java -jar /home/thang/Study/Projects/AutoDiaryServer/dist/AutoDiaryServer.jar simpleActToWindow
	#echo "\n------ using weak constraint reasoning -------"
	#echo "\n------ store simple act -------"
	echo "\n------ reasoning complex act (don't need this one) -------"
	#dlv -silent sensoring simpleAct importSimpleAct complexAct > result2.txt
	dlv -silent sensoring simpleAct importSimpleAct location complexAct
	#dlv -silent importSimpleAct complexAct > result2.txt

	echo "\n------ store complex act -------"
	#java -jar /home/thang/Study/Projects/AutoDiaryServer/dist/AutoDiaryServer.jar storeComplexAct	

	date --rfc-3339=ns	
	echo "------ sleeping -------"
	#sleep 50000000000000000
done

